home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / redakcyjne / programy / VideoLAN Client (VLC) 1.0.5 / vlc-1.0.5-win32.exe / lua / http / requests / status.xml < prev    next >
Extensible Markup Language  |  2010-01-30  |  5KB  |  144 lines

  1. <?xml version="1.0" encoding="utf-8" standalone="yes" ?<?vlcprint'>'?>
  2. <?vlc --[[
  3. vim:syntax=lua
  4. <!--  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
  5. <  status.xml: VLC media player web interface
  6. < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
  7. <  Copyright (C) 2005-2006 the VideoLAN team
  8. <  $Id$
  9. <  Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
  10. <  This program is free software; you can redistribute it and/or modify
  11. <  it under the terms of the GNU General Public License as published by
  12. <  the Free Software Foundation; either version 2 of the License, or
  13. <  (at your option) any later version.
  14. <  This program is distributed in the hope that it will be useful,
  15. <  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. <  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. <  GNU General Public License for more details.
  18. <  You should have received a copy of the GNU General Public License
  19. <  along with this program; if not, write to the Free Software
  20. <  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  21. < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  22. ]]?>
  23. <?vlc
  24.  
  25. local input = _GET['input']
  26. local command = _GET['command']
  27. local id = tonumber(_GET['id'] or -1)
  28. local val = _GET['val']
  29. local options = _GET['option']
  30. if type(options) ~= "table" then -- Deal with the 0 or 1 option case
  31.   options = { options }
  32. end
  33.  
  34. ---[[]] vlc.msg.err("requests/status.xml got:","input: "..tostring(input),"command: "..tostring(command),"id: "..tostring(id),"val: "..tostring(val))
  35.  
  36. local function stripslashes(s)
  37.   return string.gsub(s,"\\(%.)","%1")
  38. end
  39.  
  40. local status = vlc.playlist.status()
  41.  
  42. if command == "in_play" then
  43.   ---[[
  44.   vlc.msg.err( "<options>" )
  45.   for a,b in ipairs(options) do
  46.     vlc.msg.err(b)
  47.   end
  48.   vlc.msg.err( "</options>" )
  49.   --]]
  50.   vlc.playlist.add({{path=stripslashes(input),options=options}})
  51. elseif command == "in_enqueue" then
  52.   vlc.playlist.enqueue({{path=stripslashes(input),options=options}})
  53. elseif command == "pl_play" then
  54.   vlc.playlist.goto(id)
  55. elseif command == "pl_pause" then
  56.   vlc.msg.err("FIXME: pl_pause implementation is ugly")
  57.   common.hotkey("key-play-pause") -- gruik
  58. elseif command == "pl_stop" then
  59.   vlc.playlist.stop()
  60. elseif command == "pl_next" then
  61.   vlc.playlist.next()
  62. elseif command == "pl_previous" then
  63.   vlc.playlist.prev()
  64. elseif command == "pl_delete" then
  65.   vlc.msg.err("FIXME: pl_delete unimplemented")
  66.   --vlc.playlist.delete(id)
  67. elseif command == "pl_empty" then
  68.   vlc.playlist.clear()
  69. elseif command == "pl_sort" then
  70.   vlc.playlist.sort( val, id > 0 )
  71. elseif command == "pl_random" then
  72.   vlc.playlist.random()
  73. elseif command == "pl_loop" then
  74.   vlc.playlist.loop()
  75. elseif command == "pl_repeat" then
  76.   vlc.playlist.repeat_()
  77. elseif command == "pl_sd" then
  78.   if vlc.sd.is_loaded(val) then
  79.     vlc.sd.remove(val)
  80.   else
  81.     vlc.sd.add(val)
  82.   end
  83. elseif command == "fullscreen" then
  84.   vlc.fullscreen()
  85. elseif command == "snapshot" then
  86.   common.snapshot()
  87. elseif command == "volume" then
  88.   vlc.volume.set(tonumber(val))
  89. elseif command == "seek" then
  90.   common.seek(val)
  91. elseif command == "key" then
  92.   common.hotkey("key-"..val)
  93. end
  94.  
  95. local input = nil
  96. local command = nil
  97. local id = nil
  98. local val = nil
  99.  
  100. local input = vlc.object.input()
  101. local playlist = vlc.object.playlist()
  102. local vout = input and vlc.object.find(input,'vout','child')
  103. ?>
  104. <root>
  105.   <volume><?vlc print(vlc.volume.get()) ?></volume>
  106.   <length><?vlc if input then print(vlc.var.get(input,"length")) else print(0) end?></length>
  107.   <time><?vlc if input then print(vlc.var.get(input,"time")) else print(0) end?></time>
  108.   <state><?vlc print(status) ?></state>
  109.   <position><?vlc if input then print(vlc.var.get(input,"position")) else print(0) end?></position>
  110.   <fullscreen><?vlc if vout then vlc.var.get(vout,"fullscreen") else print(0) end?></fullscreen>
  111.   <random><?vlc print(vlc.var.get(playlist,"random")) ?></random>
  112.   <loop><?vlc print(vlc.var.get(playlist,"loop")) ?></loop>
  113.   <repeat><?vlc print(vlc.var.get(playlist,"repeat")) ?></repeat>
  114.   <information>
  115.   <?vlc
  116.     if input then
  117.       local info = vlc.input.info()
  118.       for k, v in pairs(info) do
  119.         print("<category name='"..k.."'>")
  120.           for k2, v2 in pairs(v) do
  121.             print("<info name='"..k2.."'>"..v2.replace('&','&').."</info>")
  122.           end
  123.         print("</category>")
  124.       end
  125.     end
  126.   ?>
  127.   </information>
  128.   <stats>
  129.   <?vlc
  130.     if input then
  131.       local stats = vlc.input.stats()
  132.       for k,v in pairs(stats) do
  133.         local tag = string.gsub(k,"_","")
  134.         print("<"..tag..">"..tostring(v).."</"..tag..">\n")
  135.       end
  136.     end
  137.   ?>
  138.   </stats>
  139. </root>
  140.